//
//  LMJBaseRequest.m
//  PLMMPRJK
//
//  Created by 谭亚明 on 2017/4/24.
//  Copyright © 2017年 GoMePrjk. All rights reserved.
//

#import "LMJBaseRequest.h"
#import "Names.h"
#import "WHToast.h"
#import "LMJRequestManager.h"
#import "Sizes.h"
@implementation LMJBaseRequest


- (void)GET:(NSString *)URLString parameters:(id)parameters completion:(void(^)(LMJBaseResponse *response))completion
{
    
    TYMWeak(self);
    [[LMJRequestManager sharedManager] GET:URLString parameters:parameters completion:^(LMJBaseResponse *response) {
        
        if (!weakself) {
            return ;
        }
        
        
        
        if (response.code == 90005) {
            [UserTool clearUserInfocompletion:^(BOOL state) {
                [[NSNotificationCenter defaultCenter] postNotificationName:@"showLoginView" object:nil];
            }];
        }
        !completion ?: completion(response);
    }];
}


- (void)POST:(NSString *)URLString parameters:(id)parameters completion:(void(^)(LMJBaseResponse *response))completion
{
    TYMWeak(self);
    [[LMJRequestManager sharedManager] POST:URLString parameters:parameters completion:^(LMJBaseResponse *response) {
        
        if (!weakself) {
            return ;
        }
        
        if (response.code == 90005) {
            [UserTool clearUserInfocompletion:^(BOOL state) {
                [[NSNotificationCenter defaultCenter] postNotificationName:@"showLoginView" object:nil];
            }];
        }
        !completion ?: completion(response);
        
    }];
}



@end
